#[doc = "Register `UART_IFLS` reader"]
pub struct R(crate::R<UART_IFLS_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<UART_IFLS_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::convert::From<crate::R<UART_IFLS_SPEC>> for R {
    fn from(reader: crate::R<UART_IFLS_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `UART_IFLS` writer"]
pub struct W(crate::W<UART_IFLS_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<UART_IFLS_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::ops::DerefMut for W {
    #[inline(always)]
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl core::convert::From<crate::W<UART_IFLS_SPEC>> for W {
    fn from(writer: crate::W<UART_IFLS_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Hardware flow control rts_n trigger condition.\n\nValue on reset: 2"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum RTSFLSEL_A {
    #[doc = "0: RX FIFO ≥ 1/8 full."]
    COND_1D8 = 0,
    #[doc = "1: RX FIFO ≥ 1/4 full."]
    COND_1D4 = 1,
    #[doc = "2: RX FIFO ≥ 1/2 full."]
    COND_1D2 = 2,
    #[doc = "3: RX FIFO ≥ 3/4 full."]
    COND_3D4 = 3,
    #[doc = "4: RX FIFO ≥ 7/8 full."]
    COND_7D8 = 4,
}
impl From<RTSFLSEL_A> for u8 {
    #[inline(always)]
    fn from(variant: RTSFLSEL_A) -> Self {
        variant as _
    }
}
#[doc = "Field `rtsflsel` reader - Hardware flow control rts_n trigger condition."]
pub struct RTSFLSEL_R(crate::FieldReader<u8, RTSFLSEL_A>);
impl RTSFLSEL_R {
    pub(crate) fn new(bits: u8) -> Self {
        RTSFLSEL_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> crate::Variant<u8, RTSFLSEL_A> {
        use crate::Variant::*;
        match self.bits {
            0 => Val(RTSFLSEL_A::COND_1D8),
            1 => Val(RTSFLSEL_A::COND_1D4),
            2 => Val(RTSFLSEL_A::COND_1D2),
            3 => Val(RTSFLSEL_A::COND_3D4),
            4 => Val(RTSFLSEL_A::COND_7D8),
            i => Res(i),
        }
    }
    #[doc = "Checks if the value of the field is `COND_1D8`"]
    #[inline(always)]
    pub fn is_cond_1d8(&self) -> bool {
        **self == RTSFLSEL_A::COND_1D8
    }
    #[doc = "Checks if the value of the field is `COND_1D4`"]
    #[inline(always)]
    pub fn is_cond_1d4(&self) -> bool {
        **self == RTSFLSEL_A::COND_1D4
    }
    #[doc = "Checks if the value of the field is `COND_1D2`"]
    #[inline(always)]
    pub fn is_cond_1d2(&self) -> bool {
        **self == RTSFLSEL_A::COND_1D2
    }
    #[doc = "Checks if the value of the field is `COND_3D4`"]
    #[inline(always)]
    pub fn is_cond_3d4(&self) -> bool {
        **self == RTSFLSEL_A::COND_3D4
    }
    #[doc = "Checks if the value of the field is `COND_7D8`"]
    #[inline(always)]
    pub fn is_cond_7d8(&self) -> bool {
        **self == RTSFLSEL_A::COND_7D8
    }
}
impl core::ops::Deref for RTSFLSEL_R {
    type Target = crate::FieldReader<u8, RTSFLSEL_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `rtsflsel` writer - Hardware flow control rts_n trigger condition."]
pub struct RTSFLSEL_W<'a> {
    w: &'a mut W,
}
impl<'a> RTSFLSEL_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: RTSFLSEL_A) -> &'a mut W {
        unsafe { self.bits(variant.into()) }
    }
    #[doc = "RX FIFO ≥ 1/8 full."]
    #[inline(always)]
    pub fn cond_1d8(self) -> &'a mut W {
        self.variant(RTSFLSEL_A::COND_1D8)
    }
    #[doc = "RX FIFO ≥ 1/4 full."]
    #[inline(always)]
    pub fn cond_1d4(self) -> &'a mut W {
        self.variant(RTSFLSEL_A::COND_1D4)
    }
    #[doc = "RX FIFO ≥ 1/2 full."]
    #[inline(always)]
    pub fn cond_1d2(self) -> &'a mut W {
        self.variant(RTSFLSEL_A::COND_1D2)
    }
    #[doc = "RX FIFO ≥ 3/4 full."]
    #[inline(always)]
    pub fn cond_3d4(self) -> &'a mut W {
        self.variant(RTSFLSEL_A::COND_3D4)
    }
    #[doc = "RX FIFO ≥ 7/8 full."]
    #[inline(always)]
    pub fn cond_7d8(self) -> &'a mut W {
        self.variant(RTSFLSEL_A::COND_7D8)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x07 << 6)) | (((value as u16) & 0x07) << 6);
        self.w
    }
}
#[doc = "RX interrupt FIFO threshold.\n\nValue on reset: 2"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum RXIFLSEL_A {
    #[doc = "0: RX FIFO ≥ 1/8 full."]
    COND_1D8 = 0,
    #[doc = "1: RX FIFO ≥ 1/4 full."]
    COND_1D4 = 1,
    #[doc = "2: RX FIFO ≥ 1/2 full."]
    COND_1D2 = 2,
    #[doc = "3: RX FIFO ≥ 3/4 full."]
    COND_3D4 = 3,
    #[doc = "4: RX FIFO ≥ 7/8 full."]
    COND_7D8 = 4,
}
impl From<RXIFLSEL_A> for u8 {
    #[inline(always)]
    fn from(variant: RXIFLSEL_A) -> Self {
        variant as _
    }
}
#[doc = "Field `rxiflsel` reader - RX interrupt FIFO threshold."]
pub struct RXIFLSEL_R(crate::FieldReader<u8, RXIFLSEL_A>);
impl RXIFLSEL_R {
    pub(crate) fn new(bits: u8) -> Self {
        RXIFLSEL_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> crate::Variant<u8, RXIFLSEL_A> {
        use crate::Variant::*;
        match self.bits {
            0 => Val(RXIFLSEL_A::COND_1D8),
            1 => Val(RXIFLSEL_A::COND_1D4),
            2 => Val(RXIFLSEL_A::COND_1D2),
            3 => Val(RXIFLSEL_A::COND_3D4),
            4 => Val(RXIFLSEL_A::COND_7D8),
            i => Res(i),
        }
    }
    #[doc = "Checks if the value of the field is `COND_1D8`"]
    #[inline(always)]
    pub fn is_cond_1d8(&self) -> bool {
        **self == RXIFLSEL_A::COND_1D8
    }
    #[doc = "Checks if the value of the field is `COND_1D4`"]
    #[inline(always)]
    pub fn is_cond_1d4(&self) -> bool {
        **self == RXIFLSEL_A::COND_1D4
    }
    #[doc = "Checks if the value of the field is `COND_1D2`"]
    #[inline(always)]
    pub fn is_cond_1d2(&self) -> bool {
        **self == RXIFLSEL_A::COND_1D2
    }
    #[doc = "Checks if the value of the field is `COND_3D4`"]
    #[inline(always)]
    pub fn is_cond_3d4(&self) -> bool {
        **self == RXIFLSEL_A::COND_3D4
    }
    #[doc = "Checks if the value of the field is `COND_7D8`"]
    #[inline(always)]
    pub fn is_cond_7d8(&self) -> bool {
        **self == RXIFLSEL_A::COND_7D8
    }
}
impl core::ops::Deref for RXIFLSEL_R {
    type Target = crate::FieldReader<u8, RXIFLSEL_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `rxiflsel` writer - RX interrupt FIFO threshold."]
pub struct RXIFLSEL_W<'a> {
    w: &'a mut W,
}
impl<'a> RXIFLSEL_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: RXIFLSEL_A) -> &'a mut W {
        unsafe { self.bits(variant.into()) }
    }
    #[doc = "RX FIFO ≥ 1/8 full."]
    #[inline(always)]
    pub fn cond_1d8(self) -> &'a mut W {
        self.variant(RXIFLSEL_A::COND_1D8)
    }
    #[doc = "RX FIFO ≥ 1/4 full."]
    #[inline(always)]
    pub fn cond_1d4(self) -> &'a mut W {
        self.variant(RXIFLSEL_A::COND_1D4)
    }
    #[doc = "RX FIFO ≥ 1/2 full."]
    #[inline(always)]
    pub fn cond_1d2(self) -> &'a mut W {
        self.variant(RXIFLSEL_A::COND_1D2)
    }
    #[doc = "RX FIFO ≥ 3/4 full."]
    #[inline(always)]
    pub fn cond_3d4(self) -> &'a mut W {
        self.variant(RXIFLSEL_A::COND_3D4)
    }
    #[doc = "RX FIFO ≥ 7/8 full."]
    #[inline(always)]
    pub fn cond_7d8(self) -> &'a mut W {
        self.variant(RXIFLSEL_A::COND_7D8)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x07 << 3)) | (((value as u16) & 0x07) << 3);
        self.w
    }
}
#[doc = "TX interrupt FIFO threshold.\n\nValue on reset: 2"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum TXIFLSEL_A {
    #[doc = "0: RX FIFO ≥ 1/8 full."]
    COND_1D8 = 0,
    #[doc = "1: RX FIFO ≥ 1/4 full."]
    COND_1D4 = 1,
    #[doc = "2: RX FIFO ≥ 1/2 full."]
    COND_1D2 = 2,
    #[doc = "3: RX FIFO ≥ 3/4 full."]
    COND_3D4 = 3,
    #[doc = "4: RX FIFO ≥ 7/8 full."]
    COND_7D8 = 4,
}
impl From<TXIFLSEL_A> for u8 {
    #[inline(always)]
    fn from(variant: TXIFLSEL_A) -> Self {
        variant as _
    }
}
#[doc = "Field `txiflsel` reader - TX interrupt FIFO threshold."]
pub struct TXIFLSEL_R(crate::FieldReader<u8, TXIFLSEL_A>);
impl TXIFLSEL_R {
    pub(crate) fn new(bits: u8) -> Self {
        TXIFLSEL_R(crate::FieldReader::new(bits))
    }
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> crate::Variant<u8, TXIFLSEL_A> {
        use crate::Variant::*;
        match self.bits {
            0 => Val(TXIFLSEL_A::COND_1D8),
            1 => Val(TXIFLSEL_A::COND_1D4),
            2 => Val(TXIFLSEL_A::COND_1D2),
            3 => Val(TXIFLSEL_A::COND_3D4),
            4 => Val(TXIFLSEL_A::COND_7D8),
            i => Res(i),
        }
    }
    #[doc = "Checks if the value of the field is `COND_1D8`"]
    #[inline(always)]
    pub fn is_cond_1d8(&self) -> bool {
        **self == TXIFLSEL_A::COND_1D8
    }
    #[doc = "Checks if the value of the field is `COND_1D4`"]
    #[inline(always)]
    pub fn is_cond_1d4(&self) -> bool {
        **self == TXIFLSEL_A::COND_1D4
    }
    #[doc = "Checks if the value of the field is `COND_1D2`"]
    #[inline(always)]
    pub fn is_cond_1d2(&self) -> bool {
        **self == TXIFLSEL_A::COND_1D2
    }
    #[doc = "Checks if the value of the field is `COND_3D4`"]
    #[inline(always)]
    pub fn is_cond_3d4(&self) -> bool {
        **self == TXIFLSEL_A::COND_3D4
    }
    #[doc = "Checks if the value of the field is `COND_7D8`"]
    #[inline(always)]
    pub fn is_cond_7d8(&self) -> bool {
        **self == TXIFLSEL_A::COND_7D8
    }
}
impl core::ops::Deref for TXIFLSEL_R {
    type Target = crate::FieldReader<u8, TXIFLSEL_A>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
#[doc = "Field `txiflsel` writer - TX interrupt FIFO threshold."]
pub struct TXIFLSEL_W<'a> {
    w: &'a mut W,
}
impl<'a> TXIFLSEL_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: TXIFLSEL_A) -> &'a mut W {
        unsafe { self.bits(variant.into()) }
    }
    #[doc = "RX FIFO ≥ 1/8 full."]
    #[inline(always)]
    pub fn cond_1d8(self) -> &'a mut W {
        self.variant(TXIFLSEL_A::COND_1D8)
    }
    #[doc = "RX FIFO ≥ 1/4 full."]
    #[inline(always)]
    pub fn cond_1d4(self) -> &'a mut W {
        self.variant(TXIFLSEL_A::COND_1D4)
    }
    #[doc = "RX FIFO ≥ 1/2 full."]
    #[inline(always)]
    pub fn cond_1d2(self) -> &'a mut W {
        self.variant(TXIFLSEL_A::COND_1D2)
    }
    #[doc = "RX FIFO ≥ 3/4 full."]
    #[inline(always)]
    pub fn cond_3d4(self) -> &'a mut W {
        self.variant(TXIFLSEL_A::COND_3D4)
    }
    #[doc = "RX FIFO ≥ 7/8 full."]
    #[inline(always)]
    pub fn cond_7d8(self) -> &'a mut W {
        self.variant(TXIFLSEL_A::COND_7D8)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !0x07) | ((value as u16) & 0x07);
        self.w
    }
}
impl R {
    #[doc = "Bits 6:8 - Hardware flow control rts_n trigger condition."]
    #[inline(always)]
    pub fn rtsflsel(&self) -> RTSFLSEL_R {
        RTSFLSEL_R::new(((self.bits >> 6) & 0x07) as u8)
    }
    #[doc = "Bits 3:5 - RX interrupt FIFO threshold."]
    #[inline(always)]
    pub fn rxiflsel(&self) -> RXIFLSEL_R {
        RXIFLSEL_R::new(((self.bits >> 3) & 0x07) as u8)
    }
    #[doc = "Bits 0:2 - TX interrupt FIFO threshold."]
    #[inline(always)]
    pub fn txiflsel(&self) -> TXIFLSEL_R {
        TXIFLSEL_R::new((self.bits & 0x07) as u8)
    }
}
impl W {
    #[doc = "Bits 6:8 - Hardware flow control rts_n trigger condition."]
    #[inline(always)]
    pub fn rtsflsel(&mut self) -> RTSFLSEL_W {
        RTSFLSEL_W { w: self }
    }
    #[doc = "Bits 3:5 - RX interrupt FIFO threshold."]
    #[inline(always)]
    pub fn rxiflsel(&mut self) -> RXIFLSEL_W {
        RXIFLSEL_W { w: self }
    }
    #[doc = "Bits 0:2 - TX interrupt FIFO threshold."]
    #[inline(always)]
    pub fn txiflsel(&mut self) -> TXIFLSEL_W {
        TXIFLSEL_W { w: self }
    }
    #[doc = "Writes raw bits to the register."]
    pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
        self.0.bits(bits);
        self
    }
}
#[doc = "UART_IFLS is the interrupt FIFO threshold select register.\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [uart_ifls](index.html) module"]
pub struct UART_IFLS_SPEC;
impl crate::RegisterSpec for UART_IFLS_SPEC {
    type Ux = u16;
}
#[doc = "`read()` method returns [uart_ifls::R](R) reader structure"]
impl crate::Readable for UART_IFLS_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [uart_ifls::W](W) writer structure"]
impl crate::Writable for UART_IFLS_SPEC {
    type Writer = W;
}
#[doc = "`reset()` method sets UART_IFLS to value 0x92"]
impl crate::Resettable for UART_IFLS_SPEC {
    #[inline(always)]
    fn reset_value() -> Self::Ux {
        0x92
    }
}
